package com.cola.Bean;

import org.apache.commons.beanutils.BeanUtils;
import org.junit.jupiter.api.Test;

import java.lang.reflect.InvocationTargetException;

/**
 * @Grup:com.cola.Bean
 * @Auther:cola
 * @Data:2021/4/7-2021-04-13:52
 * @version:1.0
 */
public class BeanTest {
    @Test
    public void test(){
        //客户端获取到的数据
        String name= "bin";
        String age="18";
        String salary="20000";

        Emp emp=new Emp();
        try {
            BeanUtils.setProperty(emp,"name",name);
            BeanUtils.setProperty(emp,"age",age);
            BeanUtils.setProperty(emp,"salary",salary);
        } catch (IllegalAccessException e) {
            e.printStackTrace();
        } catch (InvocationTargetException e) {
            e.printStackTrace();
        }
        System.out.println(emp.getInfo());
    }
}
